﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using DevExpress.Data;
using DevExpress.Web.Mvc;
using Webcar.Utils;
namespace Webcar.BLL
{
    [HandleError]
    public class BaseControler:Controller
    {
        public ActionResult ErrorContent(Exception ex)
        {
            if (ex.InnerException != null)
            {
                return Content("错误:" + ex.InnerException.Message);
            }
            else
            {
                return Content("错误:" + ex.Message);
            }
        }
        public ActionResult Success(string action,string controler,object route_values=null)
        {
            object url = Url.Action(action, controler, route_values);
            return View("Success",url);
        }
        public ActionResult SuccessAlertThenReload()
        {
            return JavaScript("window.location.reload();alert('数据保存成功！');");
        }
        public ActionResult SuccessReload()
        {
            return JavaScript("window.location.reload();");
        }

        
        //public ViewResult CustomBindingView(GridViewModel gridViewModel, IQueryable query, string viewName, string sort,ColumnSortOrder order)
        //{
        //    BindGridView(gridViewModel, query, sort, order);
        //    //return PartialView("GridViewPartialView",gridViewModel);
        //    if (viewName.IsNull())
        //        return View(gridViewModel);
        //    else
        //        return View(viewName,model:gridViewModel);
        //}

        

        //public PartialViewResult CustomBindingPartialView(GridViewModel gridViewModel, IQueryable query, string viewName, string sort, ColumnSortOrder order)
        //{
        //    BindGridView(gridViewModel,query,sort,order);
        //    //return PartialView("GridViewPartialView",gridViewModel);
        //    return PartialView(viewName, gridViewModel);
        //}

    }
}